package com.zjj.springstu.use.coreConcept.beanDefinitionReader;

import com.zjj.springstu.use.coreConcept.config.AppConfig;
import com.zjj.springstu.use.coreConcept.service.UserService;
import org.springframework.context.annotation.AnnotatedBeanDefinitionReader;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author zhanglei.zjj
 * @description 测试 AnnotatedBeanDefinitionReader
 * @date 2023/4/15 10:29
 */
public class TestAnnotatedBeanDefinitionReader {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);
        AnnotatedBeanDefinitionReader beanDefinitionReader = new AnnotatedBeanDefinitionReader(context);

        // 将UserService解析为BeanDefinition
        beanDefinitionReader.register(UserService.class);
        System.out.println(context.getBean("userService"));
    }
}
